package cn.sso.app.client.example.mappers;

import cn.ifloat.brick.sprofile.mybatis.common.BasicMapper;
import cn.sso.app.client.example.domain.Project;
import cn.sso.app.client.example.vo.ProjectVo;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.io.Serializable;
import java.util.List;

/**
 * @author: float 2023/1/12 09:49
 */
public interface ProjectMapper extends BasicMapper<Project> {

    String SQL = "<script>SELECT * FROM PROJECT ${ew.customSqlSegment}</script>";
    @Select(value = SQL)
    List<ProjectVo> listVo(@Param(Constants.WRAPPER) Wrapper wrapper);

    @Select(value = SQL)
    IPage<ProjectVo> pagerVo(IPage page, @Param(Constants.WRAPPER) Wrapper wrapper);

    @Select(value ="<script>select ${cols} FROM ${container.tableName} WHERE ${container.pkField.colName}=#{${container.pkField.name}}  </script>")
    ProjectVo getVoById(Serializable id);

}
